<template>
	<view class="distribution-section" v-if="userInfo.isDistributor">
		<view class="section-header">
			<text class="title">分销中心</text>
			<view class="more" @tap="navigateToDistribution">
				<text>查看详情</text>
				<text class="arrow">></text>
			</view>
		</view>
		<view class="distribution-info">
			<view class="info-item">
				<text class="value">¥{{userInfo.totalCommission || '0.00'}}</text>
				<text class="label">累计佣金</text>
			</view>
			<view class="info-item">
				<text class="value">¥{{userInfo.availableCommission || '0.00'}}</text>
				<text class="label">可提现佣金</text>
			</view>
			<view class="info-item">
				<text class="value">{{userInfo.teamCount || '0'}}</text>
				<text class="label">团队人数</text>
			</view>
		</view>
	</view>
</template>

<script setup>
defineProps({
	userInfo: {
		type: Object,
		default: () => ({})
	}
})

const navigateToDistribution = () => {
	uni.navigateTo({
		url: '/pages/distribution/index'
	})
}
</script>

<style lang="scss">
.distribution-section {
	background-color: #FFFFFF;
	margin: 20rpx;
	padding: 30rpx;
	border-radius: 20rpx;
	box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
	
	.section-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 30rpx;
	}
	
	.title {
		font-size: 32rpx;
		color: #333;
		font-weight: bold;
	}
	
	.more {
		display: flex;
		align-items: center;
		
		text {
			font-size: 28rpx;
			color: #999;
		}
		
		.arrow {
			margin-left: 10rpx;
		}
	}
	
	.distribution-info {
		display: flex;
		justify-content: space-between;
		
		.info-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			
			.value {
				font-size: 36rpx;
				color: #D02B29;
				font-weight: bold;
				margin-bottom: 10rpx;
			}
			
			.label {
				font-size: 24rpx;
				color: #999;
			}
		}
	}
}
</style> 